import type { App } from 'vue'
import { createHead } from '@vueuse/head'
import ElementPlus from 'element-plus'
import ElementPlusCrx from 'element-plus-crx'
import 'virtual:svg-icons-register'
// import { VabIcon } from 'vsv-icon';
// import VXETable from 'vxe-table';
// import './styles/vab.scss';
import './styles/vip.scss'

// element icons
import * as Icons from '@element-plus/icons-vue'


export const setupLib = (app: App<Element>) => {

  // register the element Icons component
  Object.keys(Icons).forEach(key => {
    app.component(key, Icons[key as keyof typeof Icons])
  })

  app.use(ElementPlus)
  app.use(ElementPlusCrx)
  app.use(createHead())
  // app.use(VXETable);
  const Plugins = import.meta.glob('./plugins/*.ts', { eager: true })
  Object.getOwnPropertyNames(Plugins).forEach((key) => {
    const plugin: any = Plugins[key]
    app.use(plugin.default)
  })
}
